package com.ywu.verify.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.verify.spi.dto.VerifyDto;
import com.ywu.verify.spi.dto.VerifyParamDto;
import com.ywu.verify.standard.service.VerifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName VerifyCodeApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/1/21 1:47
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/verify")
public class VerifyCodeApi {
    @Autowired
    private VerifyService service;

    /**
    * @Author GroundDemo
    * @Description 生成登录验证码
    * @Date 16:57 2024/3/16
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/login.verify.code")
    public CommonResult<Object> loginVerifyCode(@RequestBody VerifyParamDto dto) {
        return service.generateVerifyCodeImage(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 校验验证码
    * @Date 17:04 2024/3/16
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/login.code.verify")
    public CommonResult<Object> verifyLoginCode(@RequestBody VerifyDto dto) {
        return service.verifyLoginCode(dto);
    }
}
